<head>
    <style>
        div.test { counter-increment: test-number; }
        div.test:before { content: counter(test-number) ". "; }
    </style>
</head>
<body>
    <p>
        Test for <i><a href="rdar://problem/6131096">rdar://problem/6131096</a>
        Reproducible crash in CounterNode::isReset under guard malloc</i>.
    </p>
    <div id="view">
        <div id="destroy-me" class="test">This should not be visible</div>
        <div id="keep-me" class="test">This sentence should be numbered 1.</div>
    </div>
    <script>
        document.body.offsetTop;
        document.getElementById("destroy-me").style.display = "none";
        document.body.offsetTop;
        document.getElementById("keep-me").style.fontSize = "20px";

        if (window.testRunner) {
            testRunner.dumpAsText();
            var testResult;
            var counterValue = internals.counterValue(document.getElementById("keep-me"));
            if (counterValue == "1")
                testResult = "PASS";
            else
                testResult = 'FAIL: the counter value should have been "1", but was "' + counterValue + '".';
            var viewElement = document.getElementById("view");
            viewElement.parentNode.removeChild(viewElement);
            document.body.appendChild(document.createTextNode(testResult));
        }
    </script>
</body>
